

package com.dog.basics.admin.controller.wishwash.admin;

import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.util.R;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.wishwash.AdminDogHxWithdrawalAddDto;
import com.dog.basics.bean.dto.admin.wishwash.AdminDogHxWithdrawalEditDto;
import com.dog.basics.bean.dto.admin.wishwash.AdminDogHxWithdrawalFromDto;
import com.dog.basics.bean.vo.admin.wishwash.AdminDogHxWithdrawalVo;
import com.dog.basics.service.wishwash.DogHxWithdrawalService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 提现记录
 *
 * @author cy code generator
 * @date 2021-07-09 17:40:27
 */
@RestController
@AllArgsConstructor
@RequestMapping("/admin/doghxwithdrawal" )
@Api(value = "提现记录管理", tags = "提现记录管理")
public class DogHxWithdrawalController {

    private final  DogHxWithdrawalService dogHxWithdrawalService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param obj 提现记录
     * @return
     * @author cy code generator
     * @date 2021-07-09 17:40:27
     */
    @ApiOperation(value = "分页查询", notes = "admin_doghxwithdrawal_view")
    @GetMapping("/page" )
    @PreAuthorize("@pms.hasPermission('admin_doghxwithdrawal_view')" )
    public R<IPage<AdminDogHxWithdrawalVo>> getDogHxWithdrawalPage(PageParam page, AdminDogHxWithdrawalFromDto obj) {
        return R.ok(dogHxWithdrawalService.getAdminPageList(page,obj));
    }

    /**
     * 代理场地提现
     * @param obj 提现记录
     * @return R
     * @author cy code generator
     * @date 2021-07-09 17:40:27
     */
    @ApiOperation(value = "代理场地提现", notes = "admin_doghxwithdrawal_add")
    @SysLog("代理场地提现" )
    @PostMapping
    @PreAuthorize("@pms.hasPermission('admin_doghxwithdrawal_add')" )
    public R<Boolean>  save(@Valid  @RequestBody AdminDogHxWithdrawalAddDto obj) {
        return R.ok(dogHxWithdrawalService.saveAdminObj(obj));
    }

    /**
     * 审核提现
     * @param obj 提现记录
     * @return R
     * @author cy code generator
     * @date 2021-07-09 17:40:27
     */
    @ApiOperation(value = "审核提现", notes = "admin_doghxwithdrawal_edit")
    @SysLog("审核提现" )
    @PutMapping
    @PreAuthorize("@pms.hasPermission('admin_doghxwithdrawal_edit')" )
    public R<Boolean> updateById(@Valid  @RequestBody AdminDogHxWithdrawalEditDto obj) {
        return R.ok(dogHxWithdrawalService.editAdminObj(obj));
    }


}
